//品牌管理
$(function(){
	$('#globalSystemParamList').getList({
		"initData":{
			"num":1,
			"size":10
		},
		"url":site.apiUrl+"/back/globalSystemParam/selectGlobalSystemParamList",// 数据请求url
		"type":"get",
		"checkname":"datachk", //选择器名称，为空不显示选择器
		"col":[  //数据列
			{"field":"paramCode","display":"参数code","width":"3"},
			{"field":"paramName","display":"参数名称","width":"3"},
			{"field":"paramValue","display":"参数默认值","width":"2"},
			{"field":"paramDesc","display":"描述"}
		],
		"option":[ //操作按钮配置
			{"icon":"edit","tip":"编辑","fun":"globalSystemParamEdit('{{id}}')"},  // 花括号内可以对应相关字段
			/*{"icon":"del","tip":"删除","fun":"deleteGlobalSystemParam('{{id}}')"}*/
		]
	});
	
	//批量删除
	$("#batchDelBtn").click(function(){
		var c = "";
		$("input[name=datachk]:checked").each(function(){
			c += $(this).val()+',';
		});
		if(c!= null && c!=''){
			deleteGlobalSystemParam(c);
		}else{
			ly.toast("请选择删除项");
		}
		
	});
});
//编辑
function globalSystemParamEdit(id){
	ly.goto("globalSystemParam-creat.html?id="+id+"&globalSystemParamType=2")
}

//删除
function deleteGlobalSystemParam(id){
	var url = site.apiUrl+"/back/backUser/deleteBackUserById";
	console.log(id);
	 request({
		url:url,
		data:{"ids":id},
		type:"get",
		callback:function(f) {
			console.log(f);
			if(f.code=="rest.success"){
				ly.toast("删除成功");
				$("#backUserList").getList.refresh();//刷新当前分页
				
			}
		}
	});	
}
//查看
function backUserView(id){
	
	ly.confirm("您确定重置商家密码？",function(){
		var url = site.apiUrl+"/back/backUser/resetPassword";
		request({
		url:url,
		data:{"id":id},
		type:"post",
		callback:function(f) {
			console.log(f);
			if(f.code=="rest.success"){
				ly.toast("重置成功");
				$("#backUserList").getList.refresh();//刷新当前分页
				
			}
		}
	});	
	});
	
}

function changePic(v, o, d) {
	console.log(d);
	if(d.userHeadPicUrl!=null && d.userHeadPicUrl!= ''){
		$(o).html("<img src="+d.userHeadPicUrl+" width='30' height='30'>");
	}else{
		$(o).html("<img src='"+site.interUrl+"images/default_head.jpg' width='30' height='30'>");
	}
    
}